package com.gzxx.domain.base;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.util.Date;

/**
 * @author MAX
 * @date 2020/7/22 3:31 下午
 */
@Data
@NoArgsConstructor
public abstract class BaseEntity implements Serializable {

    private static final long serialVersionUID = -5870732305634445665L;

    public BaseEntity(Long id, Long createBy, Long updateBy, Integer revision, String idempotent) {
        this.id = id;
        this.createBy = createBy;
        this.updateBy = updateBy;
        this.revision = revision;
        this.idempotent = idempotent;
    }

    @TableId(type = IdType.AUTO)
    protected Long id;

    @TableField("create_by")
    protected Long createBy;

    @TableField("create_time")
    protected Date createTime;

    @TableField("update_by")
    protected Long updateBy;

    @TableField("update_time")
    protected Date updateTime;

    @TableField("idempotent")
    protected String idempotent;

    @TableLogic
    protected Long delFlag;

    @Version
    protected Integer revision;
}
